﻿/* MVT Charts for Silverlight - Version 1
 * 2008 by Mario Meir-Huber
 * mailto: i-mameir@microsoft.com
 *         mario@meirhuber.de
 */ 
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ChartLibrary.Base
{
    /// <summary>
    /// This sets the Font settings or gets them
    /// </summary>
    public class Font
    {
        private FontFamily _titlefont;      //stores Title fontfamily
        private double _titlesize;          //stores Title fontstretch
        private FontStyle _titlestyle;      //stores Title fontstyle
        private FontWeight _titleweight;    //stores Title fontweight

        private FontFamily _axisfont;      //stores Axis fontfamily
        private double _axissize;          //stores Axis fontstretch
        private FontStyle _axisstyle;      //stores Axis fontstyle
        private FontWeight _axisweight;    //stores Axis fontweight

        private FontFamily _legendfont;      //stores Legend fontfamily
        private double _legendsize;          //stores Legend fontstretch
        private FontStyle _legendstyle;      //stores Legend fontstyle
        private FontWeight _legendweight;    //stores Legend fontweight

        public event StateChangedEvent FontChanged; //handler to a fontchanged event
        public event StateChangedEvent DesignChanged;  //handler to a design changed event

        /// <summary>
        /// Initializes the Fonts used for the Control
        /// </summary>
        public Font()
        {
            _titlefont = new FontFamily("Arial");
            _titlesize = 12;
            _titlestyle = new FontStyle();
            _titleweight = new FontWeight();

            _axisfont = new FontFamily("Arial");
            _axissize = 12;
            _axisstyle = new FontStyle();
            _axisweight = new FontWeight();

            _legendfont = new FontFamily("Arial");
            _legendsize = 12;
            _legendstyle = new FontStyle();
            _legendweight = new FontWeight();
        }

        /// <summary>
        /// Gets the FontFamily used for the Title or sets it
        /// </summary>
        public FontFamily TitleFont 
        { 
            get
            {
                return _titlefont;
            }
            set
            {
                _titlefont = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// raises a new font changed event
        /// </summary>
        private void RaiseFontChanged()
        {
            if (null != this.FontChanged) FontChanged();
        }

        /// <summary>
        /// raises a new design changed event
        /// </summary>
        private void RaiseDesignChanged()
        {
            if (null != this.DesignChanged) DesignChanged();
        }

        /// <summary>
        /// Gets the FontStretch for the Title or sets it
        /// </summary>
        public double TitleSize
        {
            get
            {
                return _titlesize;
            }
            set
            {
                _titlesize = value;

                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontStyle for the Title or sets it
        /// </summary>
        public FontStyle TitleStyle
        {
            get
            {
                return _titlestyle;
            }
            set
            {
                _titlestyle = value;

                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontWeight for the Title or sets it
        /// </summary>
        public FontWeight TitleWeight
        {
            get
            {
                return _titleweight;
            }
            set
            {
                _titleweight = value;

                RaiseDesignChanged();
            }
        }

        /// <summary>
        /// Gets the FontFamily used for the Axis or sets it
        /// </summary>
        public FontFamily AxisFont
        {
            get
            {
                return _axisfont;
            }
            set
            {
                _axisfont = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontStretch for the Axis or sets it
        /// </summary>
        public double AxisSize
        {
            get
            {
                return _axissize;
            }
            set
            {
                _axissize = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontStyle for the Axis or sets it
        /// </summary>
        public FontStyle AxisStyle
        {
            get
            {
                return _axisstyle;
            }
            set
            {
                _axisstyle = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontWeight for the Axis or sets it
        /// </summary>
        public FontWeight AxisWeight
        {
            get
            {
                return _axisweight;
            }
            set
            {
                _axisweight = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontFamily used for the Legend or sets it
        /// </summary>
        public FontFamily LegendFont
        {
            get
            {
                return _legendfont;
            }
            set
            {
                _legendfont = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontStretch for the Legend or sets it
        /// </summary>
        public double LegendSize
        {
            get
            {
                return _legendsize;
            }
            set
            {
                _legendsize = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontStyle for the Legend or sets it
        /// </summary>
        public FontStyle LegendStyle
        {
            get
            {
                return _legendstyle;
            }
            set
            {
                _legendstyle = value;
                RaiseFontChanged();
            }
        }

        /// <summary>
        /// Gets the FontWeight for the Legend or sets it
        /// </summary>
        public FontWeight LegendWeight
        {
            get
            {
                return _legendweight;
            }
            set
            {
                _legendweight = value;
                RaiseFontChanged();
            }
        }
    }
}
